package com.atguigu.gulimall.ware.dao;

import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author zhangjianyou
 * @email 1844897920@qq.com
 * @date 2022-06-01 16:14:21
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    Long getHasStock(Long skuId);

    List<Long> getHasStockWareIds(Long skuId);

    Long lockStock(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("amount") Integer amount);

    void unLockStock(@Param("skuId") Long skuId, @Param("skuNum") Integer skuNum, @Param("wareId") Long wareId);
}
